import com.github.pagehelper.PageHelper;
import com.hxl.config.SpringConfig;
import com.hxl.domain.Account;
import com.hxl.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

public class App {
    public static void main(String[] args) {
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//        AccountService accountService = (AccountService) ctx.getBean("accountService");
//        Account ac = accountService.findById(2);
//        System.out.println(ac);

        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        AccountService accountService = (AccountService) ctx.getBean("accountService");
        PageHelper.startPage(0,2);
        List<Account> all = accountService.findAll();
        System.out.println(all.size());
//        Account ac = Account.builder().money(1500d).name("赵六liu").build();
//        accountService.save(ac);
//        System.out.println(ac);
    }
}
